home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programmer Power Tools
/
Programmer Power Tools.iso
/
microcrn
/
issue_45.arc
/
86WRLD45.ARC
/
86WRLD45.1
next >
Wrap
Text File
|
1988-03-23
|
948b
|
44 lines
; 86WORLD Figure 1 Micro Cornucopia Magazine Issue #45
; First Version of Fact, Passing Result in AX
.MODEL SMALL,PASCAL
.286c
CALLS MACRO Routine, Parameters
IRP Param,<Parameters>
IF (((.TYPE Param) AND 4) AND ((@Cpu AND 2) EQ 0))
MOV AX,Param ;constants cannot be directly
PUSH AX ;pushed on cpu's below 186
ELSE
PUSH Param
ENDIF
ENDM
CALL Routine
ENDM
.STACK 1024
.CODE
Fact PROC NEAR USES BX, Number:WORD
CMP Number,1
JNE @F
MOV AX,1
JMP Fact99
@@: MOV BX,Number
DEC BX
CALLS Fact,<BX>
ADD AX,Number
Fact99: RET
Fact ENDP
MAIN PROC NEAR
CALLS Fact,<5> ;returns fact(5) in AX
MOV AX,4C00h
INT 21h
MAIN ENDP
END MAIN